import 'package:flutter/material.dart';
import 'package:practise/biz/const/const.dart';
import 'package:practise/ui/colors.dart';
import 'package:practise/ui/discovery/discovery_dragon_ball.dart';
import 'package:practise/ui/discovery/discovery_slide_playlist.dart';

import 'discovery_banner.dart';
import 'discovery_song_list.dart';

class PageDiscovery extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ColoredBox(color: ProjectColors.PAGE_DARK, child: ListDiscovery());
  }
}

class ListDiscovery extends StatelessWidget {

  final data = Const.PAGE_DISCOVERY;

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        itemBuilder: (ctx, index) {
          var item = data[index];
          switch (item['showType']) {
            case 'BANNER':
              return RowBanner(item['banners']);
            case 'DRAGON_BALL':
              return DragonBall(item['balls']);
            case 'HOMEPAGE_SLIDE_PLAYLIST':
              return SlidePlayList(item);
            case 'HOMEPAGE_SLIDE_SONGLIST_ALIGN':
              return SongList(item);
            default:
              return Container();
          };
          /*if ('BANNER' == item['showType']) {
            return RowBanner(item['banners']);
          } else if ('DRAGON_BALL' == item['showType']) {
            return DragonBall(item['balls']);
          } else if ('HOMEPAGE_SLIDE_PLAYLIST' == item['showType']) {
            return SlidePlayList(item);
          } */
          return Container();
        },
        itemCount: data.length);
  }
}


